package com.bwie.controller;

import com.bwie.common.domain.Coupon;
import com.bwie.common.domain.request.CouponAdd;
import com.bwie.common.domain.request.CouponRequest;
import com.bwie.common.result.Result;
import com.bwie.service.CouponService;
import lombok.Data;
import org.apache.ibatis.io.ResolverUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @className: CouponConntroller
 * @Description: TODO
 * @version: v1.８.0
 * @author: 张雨乐
 * @date: 2025/9/12 10:17
 */
@CrossOrigin
@RestController

public class CouponConntroller {
    @Autowired
    private CouponService couponService;

    /**
     * 优惠卷列表
     * @param couponRequest
     * @return
     */
    @PostMapping("couponList")
    public Result couponList(@RequestBody CouponRequest couponRequest){
        return couponService.couponList(couponRequest);
    }

    /**
     * 字典表列表
     * @param id
     * @return
     */
    @GetMapping("typeList/{id}")
    public Result typeList(@PathVariable String id){
        return couponService.typeList(id);
    }
    /**
     * 添加优惠卷
     * @param couponAdd
     * @return
     */
    @PostMapping("couponAdd")
    public Result couponAdd(@RequestBody CouponAdd couponAdd){
        return couponService.couponAdd(couponAdd);
    }
    /**
     * 优惠卷记录  列表
     * @param couponRequest
     * @return
     */
    @PostMapping("couponUserList")
    public Result couponUserList(@RequestBody CouponRequest couponRequest){
        return couponService.couponUserList(couponRequest);
    }

}
